using NUnit.Framework;
using ValidationFramework;

namespace ExampleLibraryCSharp.FieldValidationManagerExamples
{
	public class ExternalExample
	{
		#region Example
		public class Person
		{


			[RequiredIntRule]
			public int age;

		}


		[TestFixture]
		public class ExampleUsage
		{
			[Test]
			public void Run()
			{
				var person = new Person();
				var fieldValidationManager = ValidationManagerFactory.GetFieldValidationManager(person);
				// Could have called fieldValidationManager.Validate() here to validate all
				// properties 
				fieldValidationManager.Validate("age");
				Assert.IsFalse(fieldValidationManager.IsValid);
				person.age = 99;
				// Could have called fieldValidationManager.Validate() here to validate all 
				// properties 
				fieldValidationManager.Validate("age");
				Assert.IsTrue(fieldValidationManager.IsValid);
			}
		}
		#endregion
	}
}